﻿using MeterReader.Models;

namespace MeterReader.Common.Extensions
{
    public static class TableMetersExtensions
    {
        public static double GetProperty(this TableMeters tableMeters, string colName)
        {
            var propertyInfo = typeof(TableMeters).GetProperty(colName);
            if (propertyInfo != null)
            {
                return (double)propertyInfo.GetValue(tableMeters, null)!;
            }
            else
            {
                throw new ArgumentException($"Property {colName} not found in TableMeters.");
            }
        }
    }
}